home *** CD-ROM | disk | FTP | other *** search
- var gnPixelInterval = 50;
- var gnTimeInterval = 500;
- var gnViewBoardWidth = 640;
- var gnViewBoardHeight= 480;
- var oList = new Array();
-
-
-
- function GetCoord( divID, direction )
- {
- if (navigator.appName == 'Netscape')
- {
- if( direction == "left" )
- return divID.left;
-
- if( direction == "top" )
- return divID.left;
- }
- else
- {
- if( direction == "left" )
- return divID.style.pixelLeft;
-
- if( direction == "top" )
- return divID.style.pixelTop;
- }
- }
-
-
-
-
- function SetCoord( divID, x, y)
- {
-
- if (navigator.appName == 'Netscape')
- {
- divID.left = x;
- divID.top = y;
- }
- else
- {
- divID.style.pixelLeft = x;
- divID.style.pixelTop = y;
- }
-
- }
-
-
-
- function ShowObject( divID, bFlag ) {
- if (navigator.appName == 'Netscape')
- {
- divID.visibility = bFlag ? 'show': 'hide'
- }
- else
- {
- divID.style.visibility = bFlag ? 'visible' : 'hidden' ;
- }
- }
-
-
-
- function create_object(name, direct)
- {
- var str = (navigator.appName == 'Netscape') ? 'document.'+name : 'document.all[\''+name+'\']';
- var object;
-
- object = eval(str);
- object.name = name;
- object.mleft = 0;
- object.mtop = 0;
- object.oleft = GetCoord( object, "left" );
- object.otop = GetCoord( object, "top" );
- object.direct = direct;
-
- // transfer position
- if( direct == "r2l" )
- object.mleft = gnViewBoardWidth;
- else if( direct == "d2u" )
- object.mtop = gnViewBoardHeight;
-
- ShowObject( object, false );
-
- return object;
- }
-
-
- function funcSetMainBoard( divID )
- {
- // var x = (screen.availWidth - gnViewBoardWidth )/2;
- // var y = (screen.availHeight - gnViewBoardHeight)/2;
- var x = 0;
- var y = 0;
-
- SetCoord( divID, x, y );
- ShowObject( divID, true );
- }
-
-
- function funcMove( idx )
- {
- var myObj = oList[idx];
-
-
- // Show Object
- if( myObj.direct == "r2l" || myObj.direct == "l2r" )
- {
- SetCoord( myObj, myObj.mleft, GetCoord(myObj, "top") );
- }
- else if( myObj.direct == "d2u" || myObj.direct == "u2d" )
- {
- SetCoord( myObj, GetCoord(myObj, "left"), myObj.mtop );
- }
-
- ShowObject( myObj, true );
-
-
-
-
-
- if( myObj.direct == "l2r" )
- {
- if( myObj.mleft < myObj.oleft )
- {
- myObj.mleft += gnPixelInterval;
- if( myObj.mleft + gnPixelInterval > myObj.oleft )
- myObj.mleft = myObj.oleft;
- setTimeout( "funcMove("+ idx +")", gnTimeInterval);
- }
- }
- else if( myObj.direct == "r2l" )
- {
- if( myObj.mleft > myObj.oleft )
- {
- myObj.mleft -= gnPixelInterval;
- if( myObj.mleft - gnPixelInterval < myObj.oleft )
- myObj.mleft = myObj.oleft;
- setTimeout( "funcMove("+ idx +")", gnTimeInterval);
- }
- }
- else if( myObj.direct == "u2d" )
- {
- if( myObj.mtop < myObj.otop )
- {
- myObj.mtop += gnPixelInterval;
- if( myObj.mtop + gnPixelInterval > myObj.otop )
- myObj.mtop = myObj.otop;
-
- setTimeout( "funcMove("+ idx +")", gnTimeInterval);
- }
- }
- else if( myObj.direct == "d2u" )
- {
- if( myObj.mtop > myObj.otop )
- {
- myObj.mtop -= gnPixelInterval;
- if( myObj.mtop - gnPixelInterval < myObj.otop )
- myObj.mtop = myObj.otop;
- setTimeout( "funcMove("+ idx +")", gnTimeInterval);
- }
- }
-
- else // if( myObj.direct == "none" )
- {
- return ;
- }
-
- }